package com.ftf.tp.user.domain.action.service.impl;

import com.ftf.tp.user.domain.action.dos.ActionDO;
import com.ftf.tp.user.domain.action.repository.ActionRepository;
import com.ftf.tp.user.domain.action.service.ActionService;
import com.ftf.tp.user.domain.data.dos.TpUserDO;
import com.ftf.tp.user.domain.data.repository.UserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author tanghao
 * @date 2022/8/25
 */
@Service
public class ActionServiceImpl implements ActionService {

    @Resource
    private ActionRepository actionRepository;

    @Resource
    private UserRepository userRepository;

    /**
     * 行为入库
     *
     * @param actionDO 行为实体
     */
    @Override
    public void save(ActionDO actionDO) {
        TpUserDO userInfo = userRepository.getUserInfo();
        actionDO.setUserId(userInfo.getId());
        actionRepository.save(actionDO);
    }
}
